import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("hello")
public class RequestHeader {

    @PostMapping("/getHeader.do")
    public String getHeader(@RequestHeader("host") String host,
                            @RequestHeader(name = "my-header", required = false,
                                    defaultValue = "3") String myHeader) {
        System.out.println("host---" + host);
        System.out.println("accept---" + myHeader);
        return "success:" + myHeader;
    }
}